﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamPaperSelect.aspx.cs" Inherits="Web.ExamPaperSelect" %>
<%@ Register TagPrefix="uc1" TagName="TopMenu" Src="TopMenu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Floor" Src="Floor.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>海淀区学校素质评测管理平台</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="js/boxy/stylesheets/boxy.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="js/boxy/javascripts/jquery.boxy.js" type="text/javascript"></script>

    <script src="js/module.js" type="text/jscript"></script>
    <script language="javascript" type="text/javascript">
    function   GetAllCheckValues(formId)    
    {      
         var ids="";
         for(var i=0 ; i< document.forms[formId].length;i++)   
         {     
            if( document.forms[formId][i].type == "checkbox" && document.forms[formId][i].checked &&  document.forms[formId][i].id.indexOf("ckItem")!=-1)      
            {   
                ids=ids+document.forms[formId][i].value+',';
            }   
         }   
         return   ids;   
    }
    function SelectAll(chAllId,formId)
    {
        var allValue=document.forms[formId][chAllId].checked;
         for(var i=0 ; i< document.forms[formId].length;i++)   
         {     
             if( document.forms[formId][i].type == "checkbox")     
             {   
                document.forms[formId][i].checked   =   allValue; 
             }   
         }   
         return   false;   
    }

    function WinReload()
    {
        window.document.forms["form1"]["btnSearch"].click();
    }
    function KnowChange()
    {
         var index =window.document.forms["form1"]["drpKnow"].selectedIndex;
         if(index!=-1)
         {
             var text="";
             text = window.document.forms["form1"]["drpKnow"].options[index].text;
             if(text=="选择")
             {
                window.document.forms["form1"]["tbKeyWord"].value="";
                return;
             }
             while(text.indexOf("|——")!=-1)
             {
                text = text.replace("|——","");
             }
             if(text!="")
             {
                 var temp="";
                 var tag =false;
                 for(var i=0;i<text.length;i++)
                 {
                    if( text.charAt(i)!=" ")
                    {
                        temp=temp+text.charAt(i);
                    }
                    else
                    {
                        break;
                    }
                 }
                 window.document.forms["form1"]["tbKeyWord"].value=temp;
             }
         }
    }
    function TxtKeyUp()
    {
        var txt= window.document.forms["form1"]["tbKeyWord"].value;
        if(txt!="")
        {
            for (var i =0;i< window.document.forms["form1"]["drpKnow"].options.length ; i++)
            {
                var text=window.document.forms["form1"]["drpKnow"].options[i].text;
                while(text.indexOf("|——")!=-1)
                {
                        text = text.replace("|——","");
                }
                if(text!="" && text.indexOf(txt)==0)
                {
                    window.document.forms["form1"]["drpKnow"].selectedIndex=i;
                    break;
                }
            }
        }
    }
    function SelctAll()
    {
       var values=  GetAllCheckValues('form1');
       var page ="<% =Pages.PageNum %>";
       if(values!=null && values!="")
       {
          values=values.substr(0,values.length-1);
          Select(values,page);
       }
    }
    </script>

</head>
<body>
    <uc1:TopMenu ID='menu1' runat='server'></uc1:TopMenu>
    <div id="main">
        <form id="form1" runat="server">
        <div id='block'>
            <div>
                <table>
                    <tr align="left">    
                        <td>题型：<asp:DropDownList ID="drpQuestionType" runat="server" Width="400px"></asp:DropDownList></td>
                        <td>内容：<asp:TextBox ID="tbTitle" runat="server" Width="320px"></asp:TextBox></td>
                        <td>&nbsp;&nbsp;<asp:Button ID="btnSearch" runat="server" Width="100px" Text="搜索"  onclick="btnSearch_Click" /></td>
                    </tr>
                    <tr  align="left">
                        <td>版本：<asp:DropDownList ID="drpVerson" runat="server"  Width="400px"></asp:DropDownList></td>
                        <td> 分数：<asp:TextBox ID="tbScore" Width="80px" runat="server"></asp:TextBox>
                            &nbsp;难度：<asp:DropDownList ID="drpDiff"  Width="80px" runat="server">
                            </asp:DropDownList>
                        </td>
                        <td >
                            &nbsp;&nbsp;<input id="btnSel" type="button" value="选入" style="width:100px;" onclick="SelctAll();" />
                        </td>
                    </tr>
                    <tr  align="left">
                        <td colspan="3">
                         知识点：<asp:DropDownList ID="drpKnow" runat="server" Width="680px">
                            </asp:DropDownList>
                         知识点代码：
                            <asp:TextBox ID="tbKeyWord"  Width="80px" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    
                </table>
            </div>
            <div id="blockcontent">
                <asp:ListView ID="UserLists" runat="server">
                    <LayoutTemplate>
                        <table cellpadding="5" cellspacing="1" border="0" width="100%" style="background-color: #DFDFDF"
                            id="userlist">
                            <tr>
                                <th width="4%"><input id="ckAll" type="checkbox" name="ckAll" onclick="SelectAll('ckAll','form1');" />
                                </th>
                                <th>
                                    标题
                                </th>
                                <th width="15%">
                                    题型
                                </th>
                                <th>
                                    难度
                                </th>
                                <th>
                                    知识点
                                </th>
                                <th width="15%">
                                    科目
                                </th>
                                <th width="10%">
                                    分数
                                </th>
                                <th width="15%">
                                    创建时间
                                </th>
                                <th width="10%">
                                    选入
                                </th>
                            </tr>
                            <asp:Label ID="itemPlaceholder" runat="server" Text="Label"></asp:Label></table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr>
                            <td><input id="ckItem" runat="server" type="checkbox" value='<%# Bind("Id")%>' />
                            </td>
                            <td align="left">
                                <%# Eval("Title")%>
                            </td>
                            <td>
                                <asp:Label ID="lbQuestionType" OnDataBinding="lbQuestionType_DataBinding" runat="server"
                                    Text='<%# Eval("QuesTypeId")%>'></asp:Label>
                            </td>
                             <td>
                                <asp:Label ID="lbDiff" OnDataBinding="lbDiff_DataBinding" runat="server" Text='<%# Eval("DifficId")%>'></asp:Label> 
                                
                            </td>
                            <td>
                                <asp:Label ID="lbKnow" OnDataBinding="lbKnow_DataBinding" runat="server" Text='<%# Eval("KnowId")%>'></asp:Label> 
                                
                            </td>
                            <td align="center">
                                <asp:Label ID="lbSubject" OnDataBinding="lbSubject_DataBinding" runat="server" Text='<%# Eval("SubjectId")%>'></asp:Label>
                            </td>
                            <td align="left">
                                <%# Eval("Score")%>
                            </td>
                            <td align="left">
                                <%# String.Format("{0:yyyy-MM-dd}", Eval("CreateDate"))%>
                            </td>
                            <td align="left">
                                <a href="javascript:Select('<%# Eval("ID")%>','<%# Pages.PageNum %>');"> 选入</a> 
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
            </div>
            <script language="javascript" type="text/javascript">
                function Select(id,page)
                {
                    var QuestionTypeid ="<% =_QuestionTypeid %>";
                    var SubjectId="<%  =_SubjectId%>";
                    var VersionId ="<% =_VersionId %>"; 
                    var ExamId ="<%= _ExamId %>";
                    var KnowId="<%=_KnowId %>";
                    var DiffId= "<% =_DiffId %>";
                    var TitleStr="<% =_TitleStr %>";
                    var Score = "<% =_Score %>";
                    var url="ExamPaperSelectSubPolicy.aspx?id="+id+"&page="+page+"&QuestionTypeid="+QuestionTypeid+"&SubjectId="+SubjectId+"&VersionId="+VersionId+"&ExamId="+ExamId+"&KnowId="+KnowId+"&DiffId="+DiffId+"&TitleStr="+TitleStr+"&Score="+Score;
                    ShowIframe(url,"试题选入",400,100);
                }
            </script>
            <div id="blockfloor">
                <asp:Label ID="PageLabel" runat="server" Text=""></asp:Label>
           </div>
           
        </div>
        </form>
    </div>

    <script type="text/javascript">
$("#userlist th").css("background-color","#eeeeee");
$("#userlist td").css("background-color","#ffffff");
    </script>
    <uc1:Floor ID='Floor1' runat='server'></uc1:Floor>
</body>
</html>
